{% extends 'base.html' %}
{% load static %}

{% block title %}我的关注 - 本地有约{% endblock %}

{% block content %}
<div class="container">
    <div class="row">
        <div class="col-12">
            <div class="card shadow">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h4><i class="bi bi-people"></i> 我的关注</h4>
                    <span class="badge bg-primary">{{ following.count }} 人</span>
                </div>
                <div class="card-body">
                    {% if following %}
                    <div class="row">
                        {% for follow in following %}
                        <div class="col-md-6 col-lg-4 mb-3">
                            <div class="card h-100">
                                <div class="card-body text-center">
                                    <div class="mb-3">
                                        {% if follow.following.avatar %}
                                            <img src="{{ follow.following.get_avatar_url }}" 
                                                 class="rounded-circle" 
                                                 alt="{{ follow.following.username }}"
                                                 style="width: 80px; height: 80px; object-fit: cover;"
                                                 onerror="this.src='{% static 'imgs/default-avatar.jpg' %}'">
                                        {% else %}
                                            <div class="rounded-circle mx-auto d-flex align-items-center justify-content-center"
                                                 style="width: 80px; height: 80px; background: #f8f9fa;">
                                                <i class="bi bi-person-circle text-muted" style="font-size: 2.5rem;"></i>
                                            </div>
                                        {% endif %}
                                    </div>
                                    
                                    <h6>{{ follow.following.nickname|default:follow.following.username }}</h6>
                                    
                                    {% if follow.following.signature %}
                                    <p class="text-muted small mb-2">{{ follow.following.signature|truncatechars:30 }}</p>
                                    {% endif %}
                                    
                                    <div class="mt-3">
                                        <a href="{% url 'users:user_profile' follow.following.id %}" 
                                           class="btn btn-sm btn-outline-primary">
                                            查看资料
                                        </a>
                                    </div>
                                </div>
                                <div class="card-footer text-muted text-center">
                                    <small>关注于 {{ follow.created_at|date:"Y-m-d" }}</small>
                                </div>
                            </div>
                        </div>
                        {% endfor %}
                    </div>
                    {% else %}
                    <div class="text-center py-5">
                        <i class="bi bi-people display-1 text-muted"></i>
                        <h5 class="mt-3 text-muted">您还没有关注任何人</h5>
                        <p class="text-muted">去发现并关注其他用户吧</p>
                        <a href="{% url 'activities:activity_list' %}" class="btn btn-primary mt-2">
                            <i class="bi bi-compass"></i> 浏览活动
                        </a>
                    </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}